<?php
namespace app\api\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author
 */
class Invoice extends Validate
{
    //定义验证规则
    protected $rule = [
        'id|ID'  => 'require|number',
        'company_name|公司名称'  => 'require',
        'tax_number|税务识别号'  => 'require',
        'money|税务识别号'  => 'require | number',
        'shou_name|收货人'  => 'require',
        'shou_phone|手机号'  => 'require|mobile',
        'shou_address|收货地址'  => 'require',
    ];
    //定义验证提示
    protected $message = [
        'id.require' => '无效的数据',
        'id.number' => '无效的数据',
        'company_name.require' => '请填写公司名称',
        'tax_number.require' => '请填写税务识别号',
        'money.require' => '金额必须填写',
        'money.number' => '金额格式不正确',
        'shou_name.require' => '姓名必须填写',
        'shou_phone.require' => '手机号必须填写',
        'shou_phone.mobile' => '手机号不正确',
        'shou_address.require' => '收货地址必须填写',
    ];
    //定义验证场景
    protected $scene = [
        'add'   =>  ['company_name','tax_number'],
        'open'   =>  ['money','shou_name,shou_phone,shou_address'],

    ];
}
